﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebDomain.Entities;

namespace WebDomain.Concrete
{
    public class EFTicketContainsRepository
    {
        private CZTopComputersEntities context = new CZTopComputersEntities();

        public IQueryable<Entities.TicketContain> TicketContains
        {
            get { return context.TicketContains; }
        }

        public void RemoveTicketContains(IEnumerable<TicketContain> ticketContains)
        {
            foreach (var tc in ticketContains)
                RemoveTicketContain(tc);
        }

        public void RemoveTicketContain(TicketContain ticketContain)
        {
            context.TicketContains.DeleteObject(ticketContain);
            context.SaveChanges();
        }

        public void SaveTicketContain(TicketContain ticketContain)
        {
            context.TicketContains.AddObject(ticketContain);
            context.SaveChanges();
        }
    }
}
